<?php

namespace App\Vilidate\authority;

/**
 * user控制器下的验证规则类
 */
class UserController
{

    public $login = [
        'rule'=>[
            'username' => 'required',
            'password' => 'required|min:6',
        ],
        'msg'=>[
            'username.required' => '用户名不能为空！',
            'password.min' => '密码不能少于6位数',
            'password.required' => '密码不能为空',
        ]
    ];

    public $changeRealName = [
        'rule'=>[
            'realname' => 'required',
        ],
        'msg'=>[
            'realname.required' => '用户名不能为空！',
        ]
    ];

    public $index = ['rule'=>[], 'msg'=>[]];

    public $changePwd = [
        'rule'=>[
            'old_password' => 'required|min:6',
            'password_repeat' => 'required|min:6',
            'password' => 'required|min:6',
        ],
        'msg'=>[
            'password_repeat.required' => '密码不能为空！',
            'password_repeat.min' => '密码不能为空！',
            'password.min' => '密码不能少于6位数',
            'password.required' => '密码不能为空',
            'old_password.min' => '密码不能少于6位数',
            'old_password.required' => '密码不能为空',
        ]
    ];

    public $view = ['rule'=>[], 'msg'=>[]];

    public $delete = ['rule'=>[], 'msg'=>[]];

    public $create = [
        'rule'=>[
            'username' => 'required',
            'real_name' => 'required',
            'password' => 'required|min:6',
            'password_repeat' => 'required|min:6',
            'roles_ids' => 'required',
            'sort' => 'required',
//            'emali' => 'email',
//            'phone' => 'phone',
            'company_id'  => 'required',
            'status' => 'required',
        ],
        'msg'=>[

            'username.required' => '用户名不能为空',
            'real_name.required' => '姓名不能为空',
            'password.required' => '密码不能为空',
            'password_repeat.required' => '重复密码不能为空',
            'roles_ids.required' => '角色不能为空',
            'password.min' => '密码不能少于6位数',
            'password_repeat.min' => '密码不能少于6位数',
            'sort.required' => '排序不能为空',
//            'phone.phone' => '电话格式不正确',
//            'email.email' => '邮箱格式不正确',
            'status.required' => '状态不能为空',
            'company_id.required' => '公司不能为空',
        ]
    ];

    public $update = [
        'rule'=>[
            'username' => 'required',
            'real_name' => 'required',
            'password' => 'min:6',
            'password_repeat' => 'min:6',
            'roles_ids' => 'required',
            'sort' => 'required',
           /* 'emali' => 'email',
            'phone' => 'phone',*/
            'company_id'  => 'required',
            'status' => 'required',
        ],
        'msg'=>[
            'username.required' => '用户名不能为空',
            'real_name.required' => '姓名不能为空',
            'roles_ids.required' => '角色不能为空',
            'password.min' => '密码不能少于6位数',
            'password_repeat.min' => '密码不能少于6位数',
//            'sort.required' => '排序不能为空',
//            'phone.phone' => '电话格式不正确',
            'emali.emali' => '邮箱格式不正确',
            'status.required' => '状态不能为空',
            'company_id.required' => '公司不能为空',
        ]
    ];


}